<template>
	<view>
		<template>
			<view v-for="(item,index) in sonList" :key="index" class="flex align-center w-100 u-p-35"
				@click="openUserExtendList(item)">
				<image :src="item.avatar" mode="aspectFill" class="avatar-list"></image>
				<view class="u-m-l-20">
					<view class="u-font-28 color333">{{item.nickname}}</view>
					<view class="u-m-t-20 u-font-24 color999">{{item.phoneNumber}}</view>
				</view>
				<u-icon class="ml-auto" name="arrow-right" size="20" color="#333333"></u-icon>
			</view>
		</template>
		<view v-if="sonList.length==0" class="u-p-t-50">
			<uni-nodata></uni-nodata>
		</view>
	</view>
</template>

<script>
	import {
		queryParentFlower,
		memberList
	} from "@/api/mine.js"
	export default {
		data() {
			return {
				sonList: [],
				superior: null,
				page: 1,
			}
		},
		onLoad() {
			this.getList();
		},
		methods: {
			//打开下级推广列表
			openUserExtendList(row) {
				uni.navigateTo({
					url: `/pages/mine/extend/userExtendList/userExtendList?name=${row.nickname}&userId=${row.userId}`
				})
			},
			getList() {
				uni.showLoading({
					mask: true
				});
				let param = {
					size: this.page,
					pageSize: 99999,
				}
				queryParentFlower().then(res => {
					if (res.code == 100000) {
						this.superior = res.data.id ? res.data : null;;
						memberList(param).then((res) => {
							if (res.code == 100000) {
								let data = res.data.data;
									this.sonList = data.slice(1);
							}
						}).finally(() => {
							uni.hideLoading();
						})
					}
				})
			}

		}
	}
</script>

<style lang="scss" scoped>
	.avatar-list {
		width: 80rpx;
		height: 80rpx;
		border-radius: 100rpx;
	}
</style>